<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // function fn(){
        //     console.log(123);
        // }

        // let fn = function(){
        //     console.log("普通函数");
        // }

        // fn()

        // let fn2 = ()=>{
        //     console.log("箭头函数");
        // }

        // fn2()


        // 优势 - 简单
        // let fn = function(a,b){
        //     return a+b;
        // }

        // console.log(fn(5,12));

        let fn = function(a){
            return a+8;
        }

        console.log(fn(5));


        // 只有一句话的时候，把{}和return删掉
        // let fn2 = (a,b)=>a+b;

        // console.log(fn2(6,8));

        // 只有一个参数的时候，省略()小括号
        let fn3 = a=>a+8;

        console.log(fn3(7));

        // arr.find(item=>item==8)

        // let fn4 = ()=>
        //     console.log('a');
        //     alert('b');

        // fn4()

        // let fn5 = a=>{return {a:12,b:5}};
        // let fn5 = a=>({a:12,b:5});

        // console.log(fn5());

        



    </script>
</body>
</html>